package com.znsd.stu.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.znsd.entitys.ClassInfo;
import com.znsd.entitys.ShiftDuty;
import com.znsd.entitys.Users;
import com.znsd.stu.dao.Cwj_ShiftDutyDao;
import com.znsd.stu.service.ZhuanBanService;
@Service
public class ZhuanBanServiceImpl implements ZhuanBanService {
	@Autowired
	private Cwj_ShiftDutyDao cwj_ShiftDutyDao;

	@Override
	public Integer addZhuanBan(Integer likeClazz, Integer clazzId, Integer stuId) {
		Users user=new Users();
		user.setUser_id(stuId);
		//想转的班级
		ClassInfo  clazz1=new ClassInfo();
		clazz1.setClazz_id(likeClazz);
		//旧的班级
		ClassInfo  clazz2=new ClassInfo();
		clazz2.setClazz_id(clazzId);
		ShiftDuty shiftDuty=new ShiftDuty();
		shiftDuty.setUser_id(user);
		shiftDuty.setNewclassid(clazz1);
		shiftDuty.setOldclassid(clazz2);
		return cwj_ShiftDutyDao.addZhuanBan(shiftDuty);
	}

	@Override
	public List<ShiftDuty> queryLimitUserZhuan(Integer user_id, Integer pageIndex, Integer limit) {
		return cwj_ShiftDutyDao.queryLimitUserZhuan(user_id,pageIndex,limit);
	}

	@Override
	public Integer queryLimitUserZhuanCount(Integer user_id) {
		return cwj_ShiftDutyDao.queryLimitUserZhuanCount(user_id);
	}

	@Override
	public Integer updateZhuanBan(Integer id) {
		return cwj_ShiftDutyDao.updateQuXiao(id);
	}

	
}
